// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.IndexManagement
{
	public sealed partial class MergeScheduler
	{
		[JsonInclude]
		[JsonPropertyName("max_merge_count")]
		public int? MaxMergeCount { get; set; }

		[JsonInclude]
		[JsonPropertyName("max_thread_count")]
		public int? MaxThreadCount { get; set; }
	}

	public sealed partial class MergeSchedulerDescriptor : SerializableDescriptorBase<MergeSchedulerDescriptor>
	{
		internal MergeSchedulerDescriptor(Action<MergeSchedulerDescriptor> configure) => configure.Invoke(this);
		public MergeSchedulerDescriptor() : base()
		{
		}

		private int? MaxMergeCountValue { get; set; }

		private int? MaxThreadCountValue { get; set; }

		public MergeSchedulerDescriptor MaxMergeCount(int? maxMergeCount)
		{
			MaxMergeCountValue = maxMergeCount;
			return Self;
		}

		public MergeSchedulerDescriptor MaxThreadCount(int? maxThreadCount)
		{
			MaxThreadCountValue = maxThreadCount;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (MaxMergeCountValue.HasValue)
			{
				writer.WritePropertyName("max_merge_count");
				writer.WriteNumberValue(MaxMergeCountValue.Value);
			}

			if (MaxThreadCountValue.HasValue)
			{
				writer.WritePropertyName("max_thread_count");
				writer.WriteNumberValue(MaxThreadCountValue.Value);
			}

			writer.WriteEndObject();
		}
	}
}